﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using ShareDef;
using System.Windows.Forms;

namespace DecKingEye
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("DecKingEye 使用方法");
            Console.WriteLine("DecKingEye d 解密");
            Console.WriteLine("DecKingEye e 加密");
            Console.WriteLine("DecKingEye q 退出");
            while (true)
            {
                Console.WriteLine("请输入操作类型：");
                string data = Console.ReadLine();
                if (data == "q")
                {
                    return;
                }
                if (data == "d")
                {
                    string fileout = "DecKingEye解密.txt";
                    Console.WriteLine("请输入加密的数据：");
                    data = Console.ReadLine();
                    string Decdata = Util.DesBase64Decrypt(data, Encoding.UTF8);
                    Console.WriteLine(Decdata);
                    Console.WriteLine("DecKingEye 解密 OK!!!");
                    File.AppendAllText(fileout, "---------------------------------\r\n");
                    File.AppendAllText(fileout, data + "\r\n");
                    File.AppendAllText(fileout, "解密后：\r\n");
                    File.AppendAllText(fileout, Decdata + "\r\n");
                }
                else if (data == "e")
                {
                    string fileout = "DecKingEye加密.txt";
                    Console.WriteLine("请输入原文数据：");
                    data = Console.ReadLine();
                    string Encdata = Util.DesBase64Encrypt(data, Encoding.UTF8);
                    Console.WriteLine("DecKingEye 加密 OK!!!");
                    File.AppendAllText(fileout, "---------------------------------\r\n");
                    File.AppendAllText(fileout, data + "\r\n");
                    File.AppendAllText(fileout, "加密后：\r\n");
                    File.AppendAllText(fileout, Encdata + "\r\n");
                }
            }
        }
    }
}
